package adv7;

import java.util.Scanner;

public class MarketTest {
    public static void main(String[] args) {
        SuperMarket superMarket=new SuperMarket("天润发","淮河路步行街");
        Scanner in=new Scanner(System.in);
        System.out.println("欢迎进入"+superMarket.getName()+"超市"+superMarket.getAddress()+"店");
        int i=0;
        while (true){
            i++;
            System.out.println("请选择您要进行的服务");
            System.out.println("1、加会员；2、查看会员信息；3、添加积分；4、积分兑换礼品；0、退出");
            int s = in.nextInt();
            switch (s) {
                case 1:
                    Customer c = new Customer();
                    System.out.println("请输入新的会员卡号：");
                    c.setNo(in.next());
                    System.out.println("请输入新的会员姓名：");
                    c.setName(in.next());
                    System.out.println("请输入新的会员手机号：");
                    c.setPhone(in.next());
                    System.out.println("请输入新的会员积分：");
                    c.setJifen(in.nextInt());
                    if (superMarket.add(i,c))
                        System.out.println("添加成功！");
                    else
                        System.out.println("添加失败！");
                    break;
                case 2:
                    superMarket.show();
                    break;
                case 3:
                    System.out.println("请输入需要查找的会员序号：");
                    int vipNo = in.nextInt();
                    System.out.println("请输入需要增加的积分数：");
                    int integral = in.nextInt();
                    if(superMarket.increaseJifen(vipNo, integral)) System.out.println("加分成功！");
                    System.out.println("查无此人，加分失败！");
                    break;
                case 4:
                    System.out.println("请输入会员序号：");
                    int vipNo1 = in.nextInt();
                    System.out.println("选择兑换的礼品：1：100分兑换餐巾纸一包；\n    2：400分兑换剃须刀一把；\n 3：1000分兑换炒锅一个；");
                    int choose = in.nextInt();
                    superMarket.Swap(vipNo1, choose);
                    break;
                case 0:
                    System.out.println("退出！");
                    return;
            }
        }
    }
}
